package com.ttg.web.controller.open;

import com.ttg.common.entities.BasePage;
import com.ttg.common.entities.BaseResult;
import com.ttg.common.utils.RequestParamsManager;
import com.ttg.model.dto.TagHisDTO;
import com.ttg.model.dto.open.*;
import com.ttg.web.dao.VipBindPeopleDao;
import com.ttg.model.vo.TagHisVo;
import com.ttg.web.service.TagHisService;
import com.ttg.web.service.VipInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhangHongYuan
 * @description
 * @date 2023/7/7 15:32
 */
@Api("开放接口")
@RestController
@RequestMapping("/open")
public class OpenVipInfoController {
    @Autowired
    private VipInfoService vipInfoService;
    @Autowired
    private VipBindPeopleDao vipBindPeopleDao;

    @Autowired
    private TagHisService tagHisService;

    @ApiOperation("editVipType")
    @PostMapping("/editVipType")
    public BaseResult editVipType(@RequestBody String data){
        EditVipTypeDto editVipTypeDto = RequestParamsManager.transformRequestParam(data, EditVipTypeDto.class);
        return vipInfoService.editVipType(editVipTypeDto);
    }

    @ApiOperation("getVipInfo")
    @PostMapping("/getVipInfo")
    public BaseResult getVipInfo(@RequestBody String data){
        GetVipInfoDto getVipInfoDto = RequestParamsManager.transformRequestParam(data, GetVipInfoDto.class);
        return vipInfoService.getVipInfo(getVipInfoDto);
    }

    @ApiOperation("queryBankInfo")
    @PostMapping("/queryBankInfo")
    public BaseResult queryBankInfo(@RequestBody String data){
        QueryBankCardDto bindBankCardDto = RequestParamsManager.transformRequestParam(data, QueryBankCardDto.class);
        return vipInfoService.queryBankInfo(bindBankCardDto);
    }

    @ApiOperation("bindBankCard")
    @PostMapping("/bindBankCard")
    public BaseResult bindBankCard(@RequestBody String data){
        BindBankCardDto bindBankCardDto = RequestParamsManager.transformRequestParam(data, BindBankCardDto.class);
        return vipInfoService.bindBankCard(bindBankCardDto);
    }

    @ApiOperation("merchantData")
    @PostMapping("/merchantData")
    public BaseResult merchantData(@RequestBody String data){
        MerchantDataDto merchantDataDto = RequestParamsManager.transformRequestParam(data, MerchantDataDto.class);
        return vipInfoService.merchantData(merchantDataDto);
    }

    @ApiOperation("queryVipData")
    @PostMapping("/queryVipData")
    public BaseResult queryVipData(@RequestBody String data){
        QueryMerchantDataDto merchantDataDto = RequestParamsManager.transformRequestParam(data, QueryMerchantDataDto.class);
        return vipInfoService.queryVipData(merchantDataDto);
    }

    @ApiOperation("queryVipEquity")
    @PostMapping("/queryVipEquity")
    public BaseResult queryVipEquity(@RequestBody String data){
        VipEquityDTO vipEquityDTO = RequestParamsManager.transformRequestParam(data, VipEquityDTO.class);
        return vipInfoService.queryVipEquity(vipEquityDTO);
    }

    @ApiOperation("queryVipTagByIdCard")
    @PostMapping("/queryVipTagByIdCard")
    public BaseResult queryVipTagByIdCard(@RequestBody String data){
        QueryVipTagByIdCardListDto queryVipTagDto = RequestParamsManager.transformRequestParam(data, QueryVipTagByIdCardListDto.class);
        return vipInfoService.queryVipTagByIdCard(queryVipTagDto);
    }

    @ApiOperation("queryVipTagByCustomerNo")
    @PostMapping("/queryVipTagByCustomerNo")
    public BaseResult queryVipTagByCustomerNo(@RequestBody String data){
        QueryVipTagByCustomerNoListDto queryVipTagDto = RequestParamsManager.transformRequestParam(data, QueryVipTagByCustomerNoListDto.class);
        return vipInfoService.queryVipTagByCustomerNo(queryVipTagDto);
    }

    @ApiOperation("queryVipTagByMctNo")
    @PostMapping("/queryVipTagByMctNo")
    public BaseResult queryVipTagByMctNo(@RequestBody String data){
        QueryVipTagByMctNoListDto queryVipTagDto = RequestParamsManager.transformRequestParam(data, QueryVipTagByMctNoListDto.class);
        return vipInfoService.queryVipTagByMctNo(queryVipTagDto);
    }

    @ApiOperation("queryVipTagConfig")
    @PostMapping("/queryVipTagConfig")
    public BaseResult queryVipTagConfig(@RequestBody String data){
        QueryVipTagConfigDto queryVipTagConfigDto = RequestParamsManager.transformRequestParam(data, QueryVipTagConfigDto.class);
        return vipInfoService.queryVipTagConfig(queryVipTagConfigDto);
    }

    @ApiOperation("queryVipGradeConfig")
    @PostMapping("/queryVipGradeConfig")
    public BaseResult queryVipGradeConfig(@RequestBody String data){
        QueryVipGradeConfigDto queryVipGradeConfigDto = RequestParamsManager.transformRequestParam(data, QueryVipGradeConfigDto.class);
        return vipInfoService.queryVipGradeConfig(queryVipGradeConfigDto);
    }

    @ApiOperation("queryVipGradeByIdCard")
    @PostMapping("/queryVipGradeByIdCard")
    public BaseResult queryVipGradeByIdCard(@RequestBody String data){
        QueryVipGradeByIdCardListDto queryVipGradeDto = RequestParamsManager.transformRequestParam(data, QueryVipGradeByIdCardListDto.class);
        return vipInfoService.queryVipGradeByIdCard(queryVipGradeDto);
    }

    @ApiOperation("queryVipGradeByMctNo")
    @PostMapping("/queryVipGradeByMctNo")
    public BaseResult queryVipGradeByMctNo(@RequestBody String data){
        QueryVipGradeByMctNoDtos queryVipGradeDto = RequestParamsManager.transformRequestParam(data, QueryVipGradeByMctNoDtos.class);
        return vipInfoService.queryVipGradeByMctNo(queryVipGradeDto);
    }

    @ApiOperation("queryVipGradeByCustomerNo")
    @PostMapping("/queryVipGradeByCustomerNo")
    public BaseResult queryVipGradeByCustomerNo(@RequestBody String data){
        QueryVipGradeByCustomerDtos queryVipGradeDto = RequestParamsManager.transformRequestParam(data, QueryVipGradeByCustomerDtos.class);
        return vipInfoService.queryVipGradeByCustomerNo(queryVipGradeDto);
    }

    @ApiOperation("queryVipByCstNo")
    @PostMapping("/queryVipByCstNo")
    public BaseResult queryVipByCstNo (@RequestBody String data){
        QueryVipByCstNoDto queryVipByCstNoDto = RequestParamsManager.transformRequestParam(data, QueryVipByCstNoDto.class);
        return vipInfoService.queryVipByCstNo(queryVipByCstNoDto);
    }

    @ApiOperation("queryTaskList")
    @PostMapping("/queryTaskList")
    public BaseResult queryTaskList (@RequestBody String data){
        QueryTaskListDto queryTaskListDto = RequestParamsManager.transformRequestParam(data, QueryTaskListDto.class);
        return vipInfoService.queryTaskList(queryTaskListDto);
    }
    @PostMapping("/bindPeopleVip")
    public BaseResult bindPeopleVip(@RequestBody String data){
        BindPeopleVipDto bindPeopleVipDto = RequestParamsManager.transformRequestParam(data, BindPeopleVipDto.class);
        return BaseResult.success(vipBindPeopleDao.bindPeopleVip(bindPeopleVipDto));
    }

    @ApiOperation("getTagStatistics")
    @PostMapping("/getTagStatistics")
    public BaseResult getTagStatistics (@RequestBody String data){
        TagStatisticsDto reqDto = RequestParamsManager.transformRequestParam(data, TagStatisticsDto.class);
        return BaseResult.success(tagHisService.getTagStatistics(reqDto));
    }

    @ApiOperation("getVipTag")
    @PostMapping("/getVipTag")
    public BaseResult getVipTag (@RequestBody String data){
        VipTagDto reqDto = RequestParamsManager.transformRequestParam(data, VipTagDto.class);
        return BaseResult.success(tagHisService.getVipTag(reqDto));
    }
}
